app.controller('brandController', function($scope, $http, $controller,
		brandService) {

	// 继承baseController
	$controller('baseController', {
		$scope : $scope
	});
	$scope.findAll = function() {
		brandService.findAll().success(function(response) {
			$scope.list = response;
		});

	}
	$scope.save = function(){
        var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
        var srcs = CryptoJS.enc.Utf8.parse($scope.entity.word);
        var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
        $scope.entity.word = encrypted.toString();
        console.log($scope.entity.word);
        /*前台解密*/
        /*var key1 = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
        var decrypt = CryptoJS.AES.decrypt($scope.entity.word, key1, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
        $scope.entity.word =  CryptoJS.enc.Utf8.stringify(decrypt).toString();
        console.log($scope.entity.word);*/
		brandService.addWord($scope.entity).success(
			function(response){
				alert(response.message);
				$scope.findAll();
			}
		);
	}

    $scope.searchEntity={}
    $scope.search = function() {
		alert("哈哈哈")
        brandService.search($scope.searchEntity.date2).success(function(response) {
            $scope.list = response;
        });
    }


});